<?php
class ConnectionComponent extends CApplicationComponent
{
    public function init() {
        // Init this component
        // $this->someconfig is already available
    }
    
    public function getConnection() {  	
    	return $this->createConnection();
    }
    
	private function createConnection() {  	
	    	return Yii::app()->db;
	    }
    
	    
	     /*
     * public function custumQuery()
	{
		$connection=Yii::app()->dbConnection->getConnection();
		$command=$connection->createCommand('select * from tbl_post');
		$rows=$command->queryAll();  
		echo '<pre>';print_r($rows);
		exit();
	}
	     */
	    
}
?>